DYN-10516: Refresh Templates and Recent Files from disk dynamically#17168
Closed
jasonstratton wants to merge 5 commits into
Closed
DYN-10516: Refresh Templates and Recent Files from disk dynamically#17168jasonstratton wants to merge 5 commits into
jasonstratton wants to merge 5 commits into
Conversation
Add a guard before opening files from the Home screen. `StartPageViewModel` now checks whether the selected Recent file or Template still exists on disk before calling `OpenCommand`. If the file was deleted or moved while Dynamo is running, Dynamo now shows a clearer missing-file warning, removes the stale item from both `RecentFiles` and `TemplateFiles`, and stops the open flow. This prevents the old behavior where a missing path could trigger a confusing invalid-path warning and leave Home stuck. `HomePage.OpenFile` uses the same guard for the WebView Home page. When a stale item is removed, it sends refreshed Recent and Template lists back to DynamoHome so the deleted card/list item disappears from the UI. A new localised resource string was added for the missing-file warning.
Refreshes Home Recent files and Templates whenever the Home page becomes visible. StartPageViewModel now exposes refresh methods that rebuild TemplateFiles from the current templates folder and rebuild RecentFiles from DynamoViewModel.RecentFiles. HomePage calls these methods when ShowStartPage changes to true, then sends the refreshed data to DynamoHome. The send methods now also pass empty lists, so if all recent files or templates were deleted or moved, DynamoHome receives [] and clears the stale Home cards.
…-Templates-and-Recent-Files-from-disk-dynamically
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10516
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Dynamo Home screen flow so Templates and Recent Files refresh from disk whenever the start page is shown again, and prevents hangs when a user clicks a tile whose backing file has been deleted.
Changes:
- Refresh Templates/Recent Files on
ShowStartPage == truetransitions and push updated (including empty) lists to the WebView UI. - Pre-validate file paths before opening to handle missing files with a clear dialog and stale-entry removal, bypassing the prior
CanOpen-dialog path that could deadlock WebView2. - Fix
RecentFiles.CollectionChangeddouble-subscription; bump DynamoHome package and add localized resource string.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs | Refreshes templates/recents on start-page show; pushes empty lists; adds missing-file pre-validation in open flow; fixes RecentFiles handler subscription. |
| src/DynamoCoreWpf/Controls/StartPage.xaml.cs | Adds refresh helpers and missing-file handling that prunes stale tiles and shows a localized warning dialog. |
| src/DynamoCoreWpf/Properties/Resources.resx | Adds MessageHomeFileMissing localized string. |
| src/DynamoCoreWpf/Properties/Resources.en-US.resx | Adds MessageHomeFileMissing localized string (en-US). |
| src/DynamoCoreWpf/Properties/Resources.Designer.cs | Adds strongly-typed accessor for MessageHomeFileMissing. |
| src/DynamoCoreWpf/DynamoCoreWpf.csproj | Bumps DynamoHome npm package version to 1.0.32. |
Files not reviewed (1)
- src/DynamoCoreWpf/Properties/Resources.Designer.cs: Generated file
Comment on lines
+127
to
142
| private async void DynamoViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) | ||
| { | ||
| if(e.PropertyName == nameof(startPage.DynamoViewModel.ShowStartPage) && dynWebView?.CoreWebView2 != null) | ||
| { | ||
| dynWebView.CoreWebView2.ExecuteScriptAsync(@$"window.setShowStartPageChanged('{startPage.DynamoViewModel.ShowStartPage}')"); | ||
| if (startPage.DynamoViewModel.ShowStartPage) | ||
| { | ||
| startPage.RefreshTemplateFiles(); | ||
| startPage.RefreshRecentFiles(); | ||
|
|
||
| await SendTemplateData(); | ||
| await SendRecentGraphsData(); | ||
| } | ||
|
|
||
| await dynWebView.CoreWebView2.ExecuteScriptAsync(@$"window.setShowStartPageChanged('{startPage.DynamoViewModel.ShowStartPage}')"); | ||
| } | ||
| } |
Comment on lines
+283
to
+287
| internal void RefreshTemplateFiles() | ||
| { | ||
| TemplateFiles.Clear(); | ||
| LoadTemplates(); | ||
| } |
Comment on lines
+705
to
+706
| RemoveMissingFilePath(RecentFiles, path); | ||
| RemoveMissingFilePath(TemplateFiles, path); |
Comment on lines
+131
to
+138
| if (startPage.DynamoViewModel.ShowStartPage) | ||
| { | ||
| startPage.RefreshTemplateFiles(); | ||
| startPage.RefreshRecentFiles(); | ||
|
|
||
| await SendTemplateData(); | ||
| await SendRecentGraphsData(); | ||
| } |
Contributor
Author
|
Closing — this branch inadvertently included upstream implementation commits. Replacing with a clean PR containing only the DynamoHome 1.0.32 version bump. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Purpose
DYN-10516: The Dynamo Home screen loaded Templates and Recent Files only at startup. Returning to Home after closing a workspace did not refresh the lists, and clicking a tile whose file had been deleted caused a hang via a WebView2 re-entrancy deadlock triggered by the archive-flavored
CanOpendialog.Key changes:
StartPage.RefreshTemplateFiles()/RefreshRecentFiles()re-read disk on demand; called fromHomePage.DynamoViewModel_PropertyChangedwheneverShowStartPagetransitions totrue, covering workspace-close and Home-button-click paths.StartPage.HandleMissingFilePath()pre-validates a path before opening: shows a clear "file no longer available" dialog, removes the stale entry from both Recent Files and Templates, and returns early — bypassingCanOpenand its nested message pump that caused the hang.HomePage.OpenFileandStartPage.HandleFilePathboth call the pre-validate before forwarding toOpenCommand, so neither path can trigger the deadlock.RecentFiles.CollectionChangedinSendRecentGraphsData.SendTemplateData/SendRecentGraphsDatanow push empty lists instead of skipping, ensuring the WebView clears stale tiles when all files are removed.DynamoCoreWpf.csproj: DynamoHome npm package bumped to 1.0.32.DynamoModel.OpenXmlFileFromPath: removed the now-redundantforceBlockRunparameter following the DYN-9707ForceBlockRuninstance refactor.MessageHomeFileMissingadded toResources.en-US.resx,Resources.resx, andResources.Designer.cs.Declarations
Check these if you believe they are true
Release Notes
Fixed a hang when clicking a missing file or template on the Home screen; Templates and Recent Files now refresh from disk each time you return to the Home screen.
Reviewers
(FILL ME IN) Reviewer 1
FYIs
(FILL ME IN, Optional)